<!--
- Author:   .
- Date:    2017/7/15 0015.
- File:    message.
-->
<template>
  <div class="Web_Box">
    <div class="newlist">
      <ul>
        <li v-for="item in noticeList.data" @click="gotoDetail(item.notice_id)">
          <p class="text3">{{item.txt}}</p>
          <p class="time">{{item.add_time | timestampToDate}}</p>
        </li>
      </ul>
      <empty-data :show="noticeList.requested && noticeList.data.length <= 0"></empty-data>
    </div>
    <footer-tab></footer-tab>
  </div>
</template>

<script>
  export default{
    data() {
      return {
        noticeList: {requested: false, data: []}
      }
    },
    created() {
      this.getNoticeList()
    },
    methods: {
      getNoticeList() {
        this.$request.getNoticeList().then(data => {
          this.noticeList.data = data
        }).finally(() => {
          this.noticeList.requested = true
        })
      },
      gotoDetail(id) {
        this.$router.push({name: 'notice-detail', params: {id: id}})
      }
    }
  }
</script>

<style>

</style>